<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //jsonp实现跨域
        function jsonp(options) {
            //创建script标签
            var script = document.getElement('script')
            //从参数中获取src属性
            script.src = options.url
            //将script标签插入当前文档
            document.body.appendChild(script)
            //使用onload监听
            script.onload = function() {
                //清除script标签
                document.body.removeChild(script)
            }

        }
        //调用jsonp并传入
        jsonp({
            url:http://127.0.0.1:3000/jsonp
        })

        //创建函数检查结果
        function () {
            console.log('jsonp被调用了')
        }
    </script>
    <!-- <script src="http://127.0.0.1:3000/jsonp"></script> -->

</body>
</html>